<?php

Yii::import('zii.widgets.CPortlet');

class TagCloud extends CPortlet
{
//	public $title='Tags';
    public $maxTags = 100;
    public $lang = 'vi';

    protected function renderContent()
    {
	$tags = Tags::model()->findTagWeights($this->lang, $this->maxTags);
	if (count($tags)) {
	    foreach ($tags as $tag => $weight) {
            $link = CHtml::link(CHtml::encode($tag),
                Helper::url('/Blog/post/index', array('lang' => $this->lang, 'tag' => $tag)),
                array(
                    'title' => $tag,
                    'style' => "font-size:{$weight}pt !important"
                )
            );
            echo CHtml::tag(
                    'p',
                    array('class' => 'body'),
                    $link
                ) . "\n";
	    }
	} else
	    echo "<p>" . Helper::t('No_Results_key') . "</p>";
    }
}